import request from '@/config/axios'

// 已开通城市 VO
export interface OpenedCityVO {
  id: number // 城市ID
  nameZhCn: string // 城市名称（中文）
  nameEnUs: string // 城市名称（英文）
  parentId: number // 父级ID
  type: boolean // 类型（0国内 1国外）
}

// 已开通城市 API
export const OpenedCityApi = {
  // 查询已开通城市列表
  getOpenedCityList: async (params) => {
    return await request.get({ url: `/business/opened-city/list`, params })
  },

  // 查询已开通城市详情
  getOpenedCity: async (id: number) => {
    return await request.get({ url: `/business/opened-city/get?id=` + id })
  },

  // 新增已开通城市
  createOpenedCity: async (data: OpenedCityVO) => {
    return await request.post({ url: `/business/opened-city/create`, data })
  },

  // 修改已开通城市
  updateOpenedCity: async (data: OpenedCityVO) => {
    return await request.put({ url: `/business/opened-city/update`, data })
  },

  // 删除已开通城市
  deleteOpenedCity: async (id: number) => {
    return await request.delete({ url: `/business/opened-city/delete?id=` + id })
  },

  // 导出已开通城市 Excel
  exportOpenedCity: async (params) => {
    return await request.download({ url: `/business/opened-city/export-excel`, params })
  },
}